﻿#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include<assert.h>

void init(int* arr, int len)
{
	assert(arr);
	assert(len);

	int i = 0;
	
	for (i = 0; i < len; i++)
	{
		arr[i] = 0;
	}
}

void print(int* arr, int len)
{
	assert(arr);
	assert(len);

	int i = 0;

	for (i = 0; i < len; i++)
	{
		printf("%d ", arr[i]);
	}

	printf("\n");
}

void reverse(int* arr, int len)
{
	assert(arr);
	assert(len);

	int left = 0;
	int right = len - 1;

	int tmp = 0;
	
	for (; left < right; left++, right--)
	{
		tmp = arr[left];
		arr[left] = arr[right];
		arr[right] = tmp;
	}
}

int main()
{
	int arr[10] = {1,2,3,4,5,6,7,8,9,10};
	int len = sizeof(arr) / sizeof(arr[0]);

	print(arr, len); //打印

	reverse(arr, len); //逆置

	print(arr, len); // 打印

	init(arr, len); //初始化

	print(arr, len); // 打印

	return 0;
}